package com.alameda.service.impl.statement;

import com.alameda.mapper.statement.AdStatementMapper;
import com.alameda.pojo.statement.AdStatementDO;
import com.alameda.service.statement.AdStatementService;
import com.alameda.statement.dto.AdStatementDTO;
import com.alameda.statement.vo.AdStatementVO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 数据报表 业务逻辑层 具体实现
 *
 * @author Lv
 * @date 2024/07/11
 */
@Slf4j
@Service
public class AdStatementServiceImpl extends ServiceImpl<AdStatementMapper, AdStatementDO> implements AdStatementService {

    @Autowired
    private AdStatementMapper adStatementMapper;

    /**
     * 读取报表数据
     *
     * @param adStatementDTO 数据报表信息
     * @return
     */
    @Override
    public List<AdStatementVO> findCount(AdStatementDTO adStatementDTO) {
        AdStatementDO adStatementDO = this.findOne(AdStatementDO.builder().statementKey(adStatementDTO.getStatementKey()).build());
        return adStatementMapper.findStatement(adStatementDO.getStatementSql());
    }
}
